WikiImport no longer returns a WikiError since the rewrite to use XmlReader
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Wed, 24 Nov 2010 11:45:01 +0000 (11:45 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Wed, 24 Nov 2010 11:45:01 +0000 (11:45 +0000)
includes/api/ApiImport.php

index 39b991a..d6bf328 100644 (file)
@@ -85,15 +85,10 @@ class ApiImport extends ApiBase {
                        $params['summary']
                );
 
-               $result = $importer->doImport();
-               if ( $result instanceof WikiXmlError ) {
-                       $this->dieUsageMsg( array( 'import-xml-error',
-                               $result->mLine,
-                               $result->mColumn,
-                               $result->mByte . $result->mContext,
-                               xml_error_string( $result->mXmlError ) ) );
-               } elseif ( WikiError::isError( $result ) ) {
-                       $this->dieUsageMsg( array( 'import-unknownerror', $result->getMessage() ) ); // This shouldn't happen
+               try {
+                       $importer->doImport();
+               } catch ( MWException $e ) {
+                       $this->dieUsageMsg( array( 'import-unknownerror', $e->getMessage() ) );
                }
 
                $resultData = $reporter->getData();